import Vue from 'vue';
import Vuex from 'vuex';
import getters from './getters';
import actions from './actions';
Vue.use(Vuex);


//state
const state = {
    count: 10,
    //用户名
    user: '',
    navTree: '',
    navInfo: {
        nav: '',
        subNav:''
    }
};
const mutations = {
    increat(state) {
        state.count++;
    },
    decrement(state, msg) {
        console.log(msg);
        state.count--;
    },
    changeUser(state, name) {
        state.user = name;
    },
    saveNavTree(state,obj) {
        state.navTree = obj;
    },
    saveNavInfo(state, obj) {
        state.navInfo = obj;
    }
}
export default new Vuex.Store({
    state,
    mutations,
    getters,
    actions
})
